package com.jic.market.mapper;

import com.jic.market.entity.PromotionPreGoodsSpu;
import com.jic.market.request.manager.presell.PresellGoodsPageQueryRequest;
import com.jic.market.response.manager.presell.PresellGoodsQueryInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 预售商品表SPU表
 * @author : 
 * @email : 
 * @since : 2020-03-28 11:30:20
 * @version : v1.0.0
 */
@Mapper
public interface  PromotionPreGoodsSpuMapper {

    long insert(PromotionPreGoodsSpu promotionPreGoodsSpu);

    long delete(Long id);

    long update(PromotionPreGoodsSpu promotionPreGoodsSpu);

    PromotionPreGoodsSpu queryByPrimaryKey(Long id);

    List<PromotionPreGoodsSpu> query(PromotionPreGoodsSpu promotionPreGoodsSpu);

    List<PromotionPreGoodsSpu> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("promotionPreGoodsSpu") PromotionPreGoodsSpu promotionPreGoodsSpu);

    long queryPageCount(PromotionPreGoodsSpu promotionPreGoodsSpu);

    List<PresellGoodsQueryInfoDto> queryPageNew(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("request") PresellGoodsPageQueryRequest request);

    long queryPageCountNew(@Param("request") PresellGoodsPageQueryRequest request);

    @Select("select p.goods_spu_id from promotion_pre_goods_spu p left join promotion_pre_goods_sku k ON p.goods_spu_id=k.goods_spu_id where k.goods_spu_id is null and p.promotion_id = #{promotionId}")
    List<Long> queryGoodsSpuIdsIsNoSku(@Param("promotionId") Long promotionId);

    void deleteNoSku(@Param("promotionId") Long promotionId, @Param("goodsSpuIds") List<Long> goodsSpuIds);

    List<PromotionPreGoodsSpu> queryPageNewNew(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("request") PresellGoodsPageQueryRequest request);

    void deleteBatchByGoodsSpuId(@Param("promotionId") Long promotionId, @Param("goodsSpuIds") List<Long> goodsSpuIds);

    long queryPageCountNewNew(@Param("request") PresellGoodsPageQueryRequest request);
}